
public class Test2 {
	
        public static long toBinary(int num) {
                long result = 0;
        long mult = 1;
        while(num / 2 > 0) {
                result += num % 2 * mult;
                mult *= 10;
                num /= 2;
        }
        if(num % 2 == 1) {
                result += mult;
        }
        return result;
        }
        public static void main(String[] args) {
                for (int i = 0; i < 1024; i++) {
                        System.out.printf("%2d %4d\n" ,i ,toBinary(i));
                }
        }
}
